
//从键盘上接收一批整数，比较并输出其中的最大值和最小值，输入数字0时结束循环 
import java.util.Scanner;

public class Demo5 {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		System.out.println("输入一个整数（输出0时结束）:");
		int num = input.nextInt();
		int max = num;
		int min = num;
		while (num != 0) {
			if (max < num) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
			System.out.println("输入一个整数（输出0时结束）:");
			num = input.nextInt();
		}
		System.out.println("最大值" + max);
		System.out.println("最小值" + min);
	}
}